/*
 * Copyright © 2017-2023 TemplateFactory(xiaoymin@foxmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.github.xiaoymin.docker.parameter;

import cn.hutool.core.util.StrUtil;

/**
 * @author <a href="mailto:xiaoymin@foxmail.com">xiaoymin@foxmail.com</a>
 * 2021/05/15 10:34
 * @since template-factory-core 1.0
 */
public class DockerDeploy {
    
    /**
     * 分组名称
     */
    private String group;
    /**
     * Docker镜像服务名称
     */
    private String name;
    /**
     * harbor平台地址
     */
    private String harbor;
    /**
     * 标签
     */
    private String tag;
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getHarbor() {
        return harbor;
    }
    
    public void setHarbor(String harbor) {
        this.harbor = harbor;
    }
    
    public String getTag() {
        return tag;
    }
    
    public void setTag(String tag) {
        this.tag = tag;
    }
    
    public String getGroup() {
        return group;
    }
    
    public void setGroup(String group) {
        this.group = group;
    }
    
    /**
     * 校验数据完整性
     * @return
     */
    public boolean validate() {
        boolean flag = false;
        if (StrUtil.isNotBlank(group) && StrUtil.isNotBlank(name) && StrUtil.isNotBlank(harbor) && StrUtil.isNotBlank(tag)) {
            flag = true;
        }
        return flag;
    }
    
    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("DockerDeploy{");
        sb.append("group='").append(group).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", harbor='").append(harbor).append('\'');
        sb.append(", tag='").append(tag).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
